/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#ifndef __RGCPP_SYSTEMCOMMAND_H__
#define __RGCPP_SYSTEMCOMMAND_H__
#ifndef _WIN32
#include <string>
#include <vector>
#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
#include <boost/algorithm/string.hpp>

namespace rgcpp
{

class SysCommand
{
	private:
		FILE* file;
		char buffer[2048];
		std::string command;

	public:
		SysCommand(const std::string& command);
		~SysCommand();

		std::string readLine();
		std::string cancel();

		static int invoke(const std::string& command);
		static int invoke(const std::string& command, const char *fmt, ...);
		static std::vector<std::string> invokeWithReturn(const std::string& command);
		static std::vector<std::string> invokeWithReturn(const std::string& command, const char *fmt, ...);
};

}
#endif
#endif
